package com.xjy.service;

import com.github.pagehelper.PageHelper;
import com.xjy.dao.adminMapper;
import com.xjy.pojo.Admin;
import com.xjy.pojo.Message;

import java.util.List;

public class adminServiceImpl implements adminService{

    private adminMapper adminMapper;
    public void setAdminMapper(adminMapper adminMapper) {
        this.adminMapper = adminMapper;
    }


    @Override
    public List<Admin> getAdmins() {
        return adminMapper.getAdmins();
    }

    @Override
    public Admin getAdminByName(String name) {
        return adminMapper.getAdminByName(name);
    }

    @Override
    public Admin getAdminById(int id) {
        return adminMapper.getAdminById(id);
    }

    @Override
    public int addAdmin(Admin admin) {
        return adminMapper.addAdmin(admin);
    }

    @Override
    public int updateAdmin(Admin admin) {
        return adminMapper.updateAdmin(admin);
    }

    @Override
    public int deleteAdmin(int uid) {
        return adminMapper.deleteAdmin(uid);
    }

    @Override
    public List<Admin> findAllAdminsByPage(Integer page, Integer size) {
        PageHelper.startPage(page, size);
        return adminMapper.getAdmins();
    }

    @Override
    public int addMessage(Message message) {
        return adminMapper.addMessage(message);
    }

    @Override
    public List<Message> getNotices(int page,int size) {
        PageHelper.startPage(page, size);
        return adminMapper.getNotices();
    }

    @Override
    public int updateNotice(String mid, String msg) {
        return adminMapper.updateNotice(mid, msg);
    }

    @Override
    public int deleteNotice(String mid) {
        return adminMapper.deleteNotice(mid);
    }

}
